package com.administrator.service;

import java.util.List;

import com.administrator.dao.UserDao;
import com.entity.Product;
import com.entity.User;

public class UserService {
	UserDao ud=new UserDao();
	
	public List<User> findAllUser(){
		List<User> list=ud.findAllUser();//service的findAllUser()要在dao层写了之后才能调用
		return list;
	}
	
	/*
	 * 验证用户添加方法	
	 */
	public boolean addUser(User p){
		if(!ud.isExist((p.getUsername()))){
			ud.addUser(p);
			return true;
		}else{
			System.out.println("此用户已存在!");
			return false;
		}	
	}
		
}
